#ifndef SERVER_SOCKET_H
#define SERVER_SOCKET_H

#include <vector>
#include "Socket.h"
#include "Singleton.h"
#include "Mutex.h"
class ServerSocket : public Socket
{
public:
	Socket* Accept();
	bool ServerOpen(int port);
};

class Server
{
public:
	Server();
	~Server();
	bool Open(int port, int clients);
	void Broadcast(SockMessage& sm);
	ServerSocket* GetListener();
	Socket* GetClient(int i);

	void AddClient(Socket* s);
	unsigned int NumOfClients();

private:
	int m_Port;
	ServerSocket m_Listener;
	int m_NumClients;
	std::vector<Socket*> m_InSocks;
	Mutex m_Mutex;
	
};
typedef Singleton<Server> TheServer;
#endif